Skip to content

replace swc with esbuild#92

Merged
ryanatkn merged 12 commits intomainfrom
esbuild
Mar 18, 2021
Merged

replace swc with esbuild#92
ryanatkn merged 12 commits intomainfrom
esbuild

Conversation

@ryanatkn
Copy link
Copy Markdown
Member

@ryanatkn ryanatkn commented Mar 16, 2021

Gro's initial choice between swc and esbuild was informed by the fact that swc worked out of the box on Svelte component JS/TS, and esbuild did not. This problem is now solved by esbuild's 0.8.28 and svelte-preprocess-esbuild.

The main caveat is that Svelte files must use import type for types or it'll throw a runtime error. (can this be fixed? where?) We also are supposed to turn on isolatedModules for TypeScript to work with esbuild, but it currently conflicts how we use src/globalTypes.ts as declarations, so we have it off, meaning TypeScript won't warn us when we use an incompatible feature. When TypeScript supports package exports in 4.3, we should be able to properly design the global types, and fix like a dozen other weird things.

So this resurfaces the question, swc or esbuild? Today, esbuild is far ahead in maturity and docs. The speed difference is likely not significant. (in my quick tests transforming the files of 2 projects, swc was faster than esbuild by about 10-15%, though I've heard esbuild does better for a lot of workloads, there may be optimizations we could add, both projects could change, but my guess is they'll remain in the same ballpark) I think swc has a bright future as a platform, but today I think it's clear esbuild is going to give us better results. I'm not sure which is the better long term tool for Gro to build on, but luckily Gro users should be mostly shielded from this decision, and we can revisit it as the ecosystem matures.

todo

  • esbuild preprocessor
  • esbuild builder
  • run some speed tests! (esbuild was ~10-15% slower compiling a couple projects)
  • remove swc
  • upgrade esbuild to 0.9 and submit PR to svelte-preprocess-esbuild
  • merge with new version of svelte-preprocess-esbuild

@ryanatkn ryanatkn marked this pull request as ready for review March 18, 2021 03:50
@ryanatkn ryanatkn merged commit cbb1502 into main Mar 18, 2021
@ryanatkn ryanatkn deleted the esbuild branch March 18, 2021 03:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant